<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>
        ${title}
    </title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="<%=basePath%>/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="<%=basePath%>/css/font-awesome.min.css">
    <link rel="stylesheet" href="<%=basePath%>/css/ionicons.min.css">
    <link rel="stylesheet" href="<%=basePath%>/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="<%=basePath%>/toastr/toastr.css" type="text/css"/>
    <link rel="stylesheet" href="<%=basePath%>/dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="<%=basePath%>/fileupload/fileinput.min.css"/>
    <link rel="stylesheet" href="<%=basePath%>/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css">
    <link rel="stylesheet" href="<%=basePath%>/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/iCheck/all.css">
    <link rel="stylesheet" href="<%=basePath%>/pagination/style/pagination.css" media="screen">
    <link rel="stylesheet" href="<%=basePath%>/plugins/iziModal/css/iziModal.min.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/iCheck/all.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/loaders/loaders.css"/>
    <link rel="stylesheet" href="<%=basePath%>/plugins/flavr/animate.css"/>
    <link rel="stylesheet" href="<%=basePath%>/plugins/flavr/flavr.css"/>
    <link rel="stylesheet" href="<%=basePath%>/plugins/bootstrap-treeview/css/bootstrap-treeview.css">
</head>
<!-- ADD THE CLASS sidedar-collapse TO HIDE THE SIDEBAR PRIOR TO LOADING THE SITE -->
    <body class="hold-transition skin-blue sidebar-mini">
    <div id="request-div" style="position: absolute;width: 100%;height: 100%;z-index: 10000;display: none;">
        <img src='../images/request-sending.gif' style="position: relative;top: 50%;left: 50%;width: 70px;height: 70px">
    </div>
    <!-- Site wrapper -->
    <div class="wrapper">
        <header class="main-header">
            <!-- Logo -->
            <jsp:include page="../logo.jsp" ></jsp:include >
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-fixed-top">
                <!-- Sidebar toggle button-->
                <a class="sidebar-toggle" data-toggle="offcanvas" role="button" onclick="show()">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <jsp:include page="../menuTop.jsp"></jsp:include>
            </nav>

        </header>

        <!-- =============================================== -->

        <!-- Left side column. contains the sidebar -->
        <aside class="main-sidebar">
            <jsp:include page="../menu.jsp"></jsp:include>
            <!-- /.sidebar -->
        </aside>

        <!-- =============================================== -->


        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper" style="padding-top:50px;">
            <section class="content-header">
                <ol class="breadcrumb">
                    <li class="text-muted"><i class="fa fa-th"></i>&nbsp;&nbsp;服务管理
                    </li>
                    <li class="text-muted"><i class="fa fa-circle-o"></i>&nbsp;&nbsp;安装
                    </li>
                </ol>
            </section>

            <input type="hidden" value="${loginUser.hospitalId}" id="hospitalId">
            <input type="hidden" id="basePath" value="<%=basePath%>/">
            <section class="content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="box box-info">
                            <div class="box-header with-border text-left">
                                <!-- 左边操作按钮 -->
                                <span class="pull-left">
                                    <!-- <button type="button" class="btn btn-infoinfoinfo btn-sm" onclick="openAssignModel()" data-original-title="分配">
                                        <i class="fa fa-hand-pointer-o"></i>
                                    </button> -->
                                    <c:if test="${loginUser.type == '1104'}">
                                        <button id="upkeepData" type="button" class="btn btn-info btn-sm" data-toggle="tooltip" title="信息补全" onclick="improveInfo()">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                    </c:if>
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip" onclick="confirm()" title="确认">
                                        <i class="fa fa-check-square"></i>
                                    </button>
                                    <c:if test="${loginUser.type == '1104'}">
                                        <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip" onclick="addEvent()" title="事件">
                                            <i class="fa fa-warning"></i>
                                        </button>
                                    </c:if>
                                </span>

                                <!-- 右边查询按钮 -->
                                <span class="pull-right">
                                    <span>显示</span>
                                    <select id="show-count" style="color: #EA544A">
                                        <option value="20">20</option>
                                        <option value="50">50</option>
                                        <option value="100">100</option>
                                        <option value="200">200</option>
                                    </select>
                                    <span>条，</span>
                                    <span>共计</span>
                                <span id="total-count">0</span>
                                <span>条</span>
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip" title="刷新"
                                            onclick="refresh()">
                                        <i class="fa fa-refresh"></i>
                                    </button>
                                    <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip" title="查询"
                                            onclick="search()">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                            </div>

                            <div class="box-body" style="margin: 5px 0px -10px 0px">
                                <!-- form start -->
                                <input type="hidden" id="apiUrl" value="<%=basePath%>/">
                                <form id="queryForm" action="<%=basePath %>/install/page" method="post">
                                    <div class="row">
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="filter-contract-no" name="contractNo" placeholder='合同编号'>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="assets-name" name="assets-name" placeholder='设备名称'>
                                            </div>
                                        </div>
                                        <!-- <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="first-party-name" name="first-party-name" placeholder='甲方'>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="second-party-name" name="second-party-name" placeholder='乙方'>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="start-date" name="start-date"placeholder='开始日期'>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <input type="text" class="form-control" id="end-date" name="end-date" placeholder='结束日期'>
                                            </div>
                                        </div> -->
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <select style="width: 100%" name="status" id="filter-status">
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="box-body table-responsive no-padding">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr class="info">
                                            <th class="text-center text-muted" style="width: 30px">#</th>
                                            <th class="text-center text-muted" style="width: 20px">操作</th>
                                            <th class="text-center text-muted" style="width: 20px">详情</th>
                                            <th class="text-muted">设备名称</th>
                                            <th class="text-muted">医院联系人</th>
                                            <th class="text-muted">医院联系电话</th>
                                            <th class="text-muted">工程师</th>
                                            <th class="text-muted">预计安装时间</th>
                                            <th class="text-muted">安装状态</th>
                                            <th class="text-muted">合同编号</th>
                                            <th class="text-muted">服务商</th>
                                            <th class="text-muted">评论状态</th>
                                        </tr>
                                    </thead>
                                    <tbody id="install_table"></tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>

        <!-- 自定义model模态框 《开始》-->

        <!-- 1.分配服务上的model -->
        <div id="assign-model" style="display: none;">
            <div class="box-body">
                <table class="table table-striped table-bordered" border="0">
                    <tr>
                        <td class="text-muted text-right">设备名称</td>
                        <td class="text-muted text-left"><span id="deviceNameSpan"></span></td>
                        <td class="text-muted text-right">设备型号</td>
                        <td class="text-muted text-left"><span id="deviceModelSpan"></span></td>
                    </tr>

                    <tr>
                        <td class="text-muted text-right">设备序列号</td>
                        <td class="text-muted text-left"><span id="snSpan"></span></td>
                    </tr>

                    <tr>
                        <td class="text-muted text-right">厂商</td>
                        <td class="text-muted text-left"><span id="manufacturerNameSpan"></span></td>
                        <td class="text-muted text-right">厂商联系人</td>
                        <td class="text-muted text-left"><span id="manufacturerContactsSpan"></span></td>
                    </tr>

                    <tr>
                        <td class="text-muted text-right">厂商联系人电话</td>
                        <td class="text-muted text-left"><span id="manufacturerPhoneSpan"></span></td>
                        <td class="text-muted text-right"> 维保合同有效期</td>
                        <td class="text-muted text-left"><span id="endGuaranteeDateSpan"></span></td>
                    </tr>

                    <tr>
                        <td class="text-muted text-right">设备保内外状态</td>
                        <td class="text-muted text-left"><span id="InsideOutsideStrSpan"></span></td>
                        <td class="text-muted text-right"> 维修商</td>
                        <td class="text-muted text-left"><span id="maintainerNameSpan"></span></td>
                    </tr>

                    <tr>
                        <td class="text-muted text-right">维修商联系人</td>
                        <td class="text-muted text-left"><span id="maintainerContactsSpan"></span></td>
                        <td class="text-muted text-right"> 维修商联系人电话</td>
                        <td class="text-muted text-left"><span id="maintainerPhoneSpan"></span></td>
                    </tr>
                </table>
                <form id="assignForm" class="col-md-12" style="padding: 15px">
                    <div class="col-md-6 form-group">
                        <label  class="col-sm-4 control-label text-muted">服务商<span class="text-red">*</span></label>
                        <div class="col-sm-8">
                            <select style="width: 100%" name="assignMaintainer" id="assign-maintainer">
                            </select>
                        </div>
                    </div>

                    <div class="col-md-6 form-group">
                        <label  class="col-sm-4 control-label text-muted">是否指派负责人</label>
                        <div class="col-md-8" >
                            <div class="radio" style="margin-top: 3px">
                                <label>
                                    <input type="radio" class="flat-green" value="1" name="is_dispatch">是
                                </label>
                                <label>
                                    <input type="radio" class="flat-green" name="is_dispatch" checked value="0">否
                                </label>
                            </div>
                        </div>
                    </div>

                    <div id="dispatchDiv" style="display: none;">
                        <div class="col-md-6  form-group">
                            <label  class="col-sm-4 control-label text-muted">派工时间<span class="text-red">*</span></label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="dispathTime" id="dispathTime">
                            </div>
                        </div>

                        <div class="col-md-6  form-group">
                            <label  class="col-sm-4 control-label text-muted">负责人姓名<span class="text-red">*</span></label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="engineerName" id="engineerName">
                            </div>
                        </div>

                        <div class="col-md-6  form-group">
                            <label  class="col-sm-4 control-label text-muted">负责人电话<span class="text-red">*</span></label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="engineerPhone" id="engineerPhone">
                            </div>
                        </div>

                        <div class="col-md-6  form-group">
                            <label  class="col-sm-4 control-label text-muted">医院联系人<span class="text-red">*</span></label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="hospitalContacts" id="hospitalContacts">
                            </div>
                        </div>

                        <div class="col-md-6 form-group">
                            <label  class="col-sm-4 control-label text-muted">医院联系人电话<span class="text-red">*</span></label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="hospitalPhone" id="hospitalPhone">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="box-footer">
                <span class="pull-right">
                    <button data-iziModal-close class="btn btn-default" style="margin-right: 5px">关闭</button>
                    <button class="btn btn-primary" style="margin-right: 5px" onclick="submitAssign()">提交</button>
                </span>
            </div>
        </div>
        <div id="improve-model" style="display: none;">
            <div class="box-body">
                <form id="improve-form" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="keyType" value="1404">
                    <input type="hidden" name="installId" id="improveInstallId">
                    <input type="hidden" name="contractDeviceActualSendId" id="contractDeviceActualSendId">
                    <input type="hidden" name="fileIds" id="improveFileIds">
                    <input type="hidden" name="deviceId" id="deviceId">
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">实际安装时间</label>
                        <div class="col-md-8 form-group" >
                            <input  class="form-control" name="actualInstallDate" id="actualInstallDate"/>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">序列号</label>
                        <div class="col-md-8 form-group" >
                            <input  class="form-control" name="sn" id="sn"/>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">科室</label>
                        <div class="col-md-8 form-group" >
                            <input  class="form-control" name="department" id="department"/>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">资产编号</label>
                        <div class="col-md-8 form-group" >
                            <input  class="form-control" name="assetsNo" id="assetsNo"/>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">设备启用时间</label>
                        <div class="col-md-8 form-group" >
                            <input  class="form-control" name="enableTime" id="enableTime"/>
                        </div>
                    </div>
                    <!-- <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">文件类型</label>
                        <div class="col-md-8 form-group">
                            <select class="form-control" style="width: 100%" name="fileType">
                                <option value='3200'>安装设备图片</option>
                                <option value='3201'>安装工单</option>
                                <option value='3202'>验收设备图片</option>
                                <option value='3203'>验收单</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">文件</label>
                        <div class="col-md-8 form-group" >
                            <input type="file" name="files" class="file" id="files" multiple/>
                        </div>
                    </div> -->
                </form>
                <form id="improve-one" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">安装设备图片</label>
                        <div class="col-md-8 form-group" >
                            <input type="hidden" name="keyType" value="1404">
                            <input type="hidden" name="fileType" value="3200">
                            <input type="hidden" name="installId" id="installIdOne">
                            <input type="hidden" name="fileIds" id="improveOneFileIds">
                            <input type="file" name="files" class="file" id="files" multiple/>
                        </div>
                    </div>
                </form>
                <form id="improve-two" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">安装工单</label>
                        <div class="col-md-8 form-group" >
                            <input type="hidden" name="keyType" value="1404">
                            <input type="hidden" name="fileType" value="3201">
                            <input type="hidden" name="installId" id="installIdTwo">
                            <input type="hidden" name="fileIds" id="improveTwoFileIds">
                            <input type="file" name="files" class="file" id="files" multiple/>
                        </div>
                    </div>
                </form>
                <form id="improve-three" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">验收设备图片</label>
                        <div class="col-md-8 form-group" >
                            <input type="hidden" name="keyType" value="1404">
                            <input type="hidden" name="fileType" value="3202">
                            <input type="hidden" name="installId" id="installIdThree">
                            <input type="hidden" name="fileIds" id="improveThreeFileIds">
                            <input type="file" name="files" class="file" id="files" multiple/>
                        </div>
                    </div>
                </form>
                <form id="improve-four" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="col-md-12">
                        <label  class="col-sm-4 control-label text-muted">验收单</label>
                        <div class="col-md-8 form-group" >
                            <input type="hidden" name="keyType" value="1404">
                            <input type="hidden" name="fileType" value="3203">
                            <input type="hidden" name="installId" id="installIdFour">
                            <input type="hidden" name="fileIds" id="improveFourFileIds">
                            <input type="file" name="files" class="file" id="files" multiple/>
                        </div>
                    </div>
                </form>
            </div>
            <div class="box-footer">
                 <span class="pull-right">
                    <button data-iziModal-close class="btn btn-default" style="margin-right: 5px">关闭</button>
                    <button  class="btn btn-primary" onclick="improveConfirm()" style="margin-right: 5px">提交</button>
                </span>
            </div>
        </div>
        <!-- 自定义model模态框 《结束》-->
        <div id="saveEventDiv"></div>
        <div id="confirmDiv"></div>
        <!-- 自定义model模态框 《结束》-->

        <footer class="main-footer">
            <div class="pull-right hidden-xs">
                <b>Version</b> 1.0.0
            </div>
            <strong>Copyright &copy; 2019 <a href="http://almsaeedstudio.com">Topmed</a>.</strong> All rights reserved.
        </footer>
        <jsp:include page="../menuRight.jsp"></jsp:include>
    </div>
    <!-- ./wrapper -->

    <!-- ./wrapper -->
    <script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="<%=basePath%>/bootstrap/js/bootstrap.min.js"></script>
    <script src="<%=basePath%>/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script src="<%=basePath%>/plugins/fastclick/fastclick.js"></script>
    <script src="<%=basePath%>/dist/js/app.min.js"></script>
    <script src="<%=basePath%>/dist/js/demo.js"></script>
    <script src="<%=basePath%>/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
    <script src="<%=basePath%>/toastr/toastr.js"></script>
    <script src="<%=basePath%>/pagination/js/jquery.pagination.min.js"></script>
    <script src="<%=basePath%>/js/overallSituation.js"></script>
    <script src="<%=basePath%>/fileupload/fileinput.min.js"></script>
    <script src="<%=basePath%>/fileupload/zh.js" type="text/javascript"></script>
    <script src="<%=basePath%>/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script src="<%=basePath%>/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="<%=basePath%>/plugins/select2/select2.min.js"></script>
    <script src="<%=basePath%>/plugins/select2/i18n/zh-CN.js"></script>
    <script src="<%=basePath%>/plugins/iCheck/icheck.min.js"></script>
    <script src="<%=basePath%>/plugins/iziModal/js/iziModal.min.js"></script>
    <script src="<%=basePath%>/plugins/flavr/flavr.min.js"></script>
    <script src="<%=basePath%>/plugins/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="<%=basePath%>/js/event-add.js"></script>
    <script src="<%=basePath%>/js/public-confirm.js"></script>
    <script src="<%=basePath%>/js/install/install-page.js"></script>
    </body>
</html>
